package com.patternsbox.behavioral.memento;

import com.patternsbox.ActionTemplate;

public class MementoAction extends ActionTemplate {

	public void doAction() {
	      Originator o = new Originator();
	      o.setState("On");
	      // Store internal state
	      Caretaker c = new Caretaker();
	      c.setMemento(o.createMemento());
	      // Continue changing originator
	      o.setState("Off");
	      // Restore saved state
	      o.setMemento(c.getMemento());
	}
}
